package homework.mid_autumn_festival.collection_exercixe;

import java.util.ArrayList;
import java.util.List;

public class ListDemo3 {
    public static void main(String[] args) {
        List<Integer> list = new ArrayList<>();
        for (int i=0;i<10;i++){
            list.add(i*10);
        }
        System.out.println("list:"+list);

        List<Integer> sublist = list.subList(3,8);//获取下标3-7的元素
        System.out.println("sublist:"+sublist);

        //将子集每个元素扩大10倍
        for (int i=0;i<sublist.size();i++){
            sublist.set(i,sublist.get(i)*10);
        }
        System.out.println("subList:"+sublist);
        System.out.println("list:"+list);

        list.set(0,300);
        System.out.println("subList:"+sublist);
        System.out.println("list:"+list);

        list.remove(0);
        System.out.println("subList:"+sublist);










    }
}
